home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Shareware
/
IDimager Personal 4.2.0.3
/
setup_IDimager_Personal_V4.exe
/
{app}
/
Scripts
/
GPS Scripts
/
Remove GPS Data.psc
< prev
next >
Wrap
Text File
|
2008-05-08
|
2KB
|
73 lines
{
This script will completely remove all GPS info from your images. It deletes
GPS coordinates from XMP as well as Exif. This can not be undone (unless you
retag your images with GPS coordinates).
}
function CleanupGPS (AImage: TImageItem): Boolean;
var
AXmp: TXMP;
ATif: TTif;
begin
result := False;
// cleanup XMP
AXmp := TXMP.Create(False);
Catalog.LoadXMPForImage (AImage, AXmp, Options.CachedXMP);
if AXmp.HasGPS then
begin
result := True;
AXmp.RemoveGPS;
Catalog.SaveXMPForImage (AImage, AXmp, Options.CachedXMP);
end;
AXmp.Free;
// cleanup Exif
ATif := TTif.Create(nil);
ATif.FileName := AImage.ExifFileName;
ATif.Load (True, False);
if ATif.HasGPS then
begin
result := True;
ATif.RemoveGPS;
ATif.UpdateTags;
end;
ATif.Free;
end;
var
i: Integer;
AHit: Integer;
begin
if not Ask ('Are you sure you want to remove all GPS data (XMP and Exif) for the selected images?') then
exit;
Progress.Cancel := False;
Progress.ProgressBar := True;
Progress.UseProgress;
Progress.Max := Selected.Count;
Progress.Show;
AHit := 0;
for i := 0 to Selected.Count - 1 do
begin
Progress.ProgressText := Selected.Items[i].FileName;
Progress.Pos := i + 1;
if Progress.Cancel then
break;
if CleanupGPS(Selected.Items[i]) then
Inc(AHit);
end;
Progress.Hide;
// repaint selected images in collection
InvalidateSelected;
if Progress.Cancel then
Say (WideFormat ('Cancelled; %d images cleaned so far', [AHit]))
else
Say (WideFormat ('Finished; %d images cleaned', [AHit]));
end;